package main.java.web.servlet;

import main.java.domain.User;
import main.java.service.impl.UserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.List;

@WebServlet("/correctionServlet")
public class CorrectionServlet extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // 获取请求参数
        String taskID = request.getParameter("task_id");

        HttpSession session = request.getSession();
        // 获取学生列表
        UserServiceImpl userService = new UserServiceImpl();
        List<User> users = userService.findAll();

        request.setAttribute("students", users);

        request.getRequestDispatcher("/studentList.jsp?task_id="+taskID).forward(request, response);
    }
}
